package com.jiyun.service;

import com.jiyun.mapper.UserMapper;
import com.jiyun.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> findAll() {
        List<User> userList = userMapper.selectList(null);
        return userList;
    }

    @Override
    public void add(User user) {
        userMapper.insert(user);
    }

    @Override
    public void update(User user) {
        userMapper.updateById(user);
    }

    @Override
    public User findById(Integer id) {
        User user=userMapper.selectById(id);
        return user;
    }

    @Override
    public void delete(Integer id) {
        userMapper.deleteById(id);
    }
}
